package com.fitness.fitness.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fitness.fitness.modal.user.entity.User;
import com.fitness.fitness.modal.user.param.UserPageQueryParams;
import org.apache.ibatis.annotations.Select;

public interface UserMapper extends BaseMapper<User> {

    @Select("<script>select * from t_user u"
            + " <where>"
            + "<if test='queryParams.keyword != null and queryParams.keyword.trim() neq \"\"'>"
            + " AND m.username like  CONCAT('%',#{queryParams.keyword},'%')"
            + "</if>"
            + "<if test='queryParams.status != null'>"
            + " AND m.status = #{queryParams.status}"
            + "</if>"
            + "</where>"
            +"</script>")
    Page<User> getUserPage(Page<User> page, UserPageQueryParams queryParams);
}
